/*
 * Queue.c
 *
 *  Created on: 11/11/2011
 *      Author: marcio
 */

#include "Queue.h"

typedef struct nl{
	void* elem;
	struct nl* next;
}NodeQueue;

Queue* queue_newQueue(){
	Queue* q = malloc(sizeof(Queue));
	q->head = malloc(sizeof(NodeQueue));
	q->last = q->head;
	return NULL;
}

int queue_add(Queue* q, void* elem){
	NodeQueue* newnode = mallaoc(sizeof(NodeQueue));
	if(elem != null){
		newnode->elem = elem;
		(NodeQueue*)s->last = ((NodeQueue*)s->last)->next = newnode;
		return 0;
	}
	return 1;
}

void* queue_get(Queue* q){
	return ((NodeQueue*)s->head)->elem;
}

void* queue_push(Queue* q){
	NodeQueue aux = ((NodeQueue*)s->head)->elem;
	((NodeStack*)s->head) = ((NodeStack*)s->head)->next;
	return aux;
}

int queue_isEmpty(Queue* q){
	return q->head == q->last;
}
